export default {
  data() {
    return {
      colWidths: {}, colWidthKey: this.$route.name
    }
  },
  methods: {
    // 拖动表头改变列宽
    colChange(newWidth, oldWidth, column, event) {
      this.colWidths[column.property] = newWidth
      localStorage.setItem(this.colWidthKey, JSON.stringify(this.colWidths))
    },
    // 获取浏览器缓存的列宽
    getTableColWidth() {
      var tableWidth = localStorage.getItem(this.colWidthKey)
      if (tableWidth) {
        this.colWidths = JSON.parse(tableWidth)
      }
    }
  }
}
